package com.boss.salary.service.impl;

import com.boss.common.entity.PageDTO;
import com.boss.framework.dto.PaginationDTO;
import com.boss.salary.dao.IFilePathDao;
import com.boss.salary.entity.FilePath;
import com.boss.salary.service.IFilePathService;
import com.boss.sys.utils.SysUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FilePathServiceImpl implements IFilePathService {

    /**
     * 引入日志框架常量
     */
    private final static Logger logger = LoggerFactory.getLogger(FilePathServiceImpl.class);
    @Autowired
    private IFilePathDao Dao;

    @Override
    public void insertFilePath(FilePath filePath) {
        filePath.setId(SysUtils.generateGuid());
        Dao.insertFilePath(filePath);
    }

    @Override
    public void deleteFilePath(String id, String mofDivCode) {
        Dao.deleteFilePath(id,mofDivCode);
    }

    @Override
    public void updateFilePath(FilePath filePath) {
        Dao.updateFilePath(filePath);
    }

    @Override
    public PageDTO<FilePath> queryFilePath(PaginationDTO paginationDTO, String province) {
        List<FilePath> list = Dao.queryFilePath(paginationDTO, province);
        int total = Dao.queryFilePathTotal(province);
        PageDTO<FilePath> pageDTO = new PageDTO<>();
        pageDTO.setRows(list);
        pageDTO.setTotal(total);
        return pageDTO;
    }
}
